package com.sky.mapper;

import com.sky.entity.OrderDetail;
import com.sky.vo.SalesTop10ReportVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrderDetailMapper {


    /**
     * 批量插入订单明细数据
     * @param orderDetailList
     */
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
     * 根据订单id查询订单明细
     * @param orderId
     * @return
     */
    @Select("select id, name, image, order_id, dish_id, setmeal_id, dish_flavor, number, amount from order_detail where order_id = #{orderId}")
    List<OrderDetail> selectByOrderId(Long orderId);

    /**
     * 查询销量排名topX
     *
     * @param begin
     * @param end
     * @param x     销量排名前x名
     * @param status
     * @return
     */
    List<SalesTop10ReportVO> selectTop10(LocalDateTime begin, LocalDateTime end, Integer x, Integer status);
}
